<?php /* Smarty version 2.6.25, created on 2016-09-06 16:10:11
         compiled from book.index.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'request_em', 'book.index.tpl', 5, false),)), $this); ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "header.tpl", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<div class="comBox">
    <div class="comHeader">
        <form action="" method="GET">
            <input type="hidden" name="ct" value="<?php echo smarty_function_request_em(array('key' => 'ct'), $this);?>
" />
            <input type="hidden" name="ac" value="<?php echo smarty_function_request_em(array('key' => 'ac'), $this);?>
" />
            <b>日期</b>
            <input type='text' name='start_date' id="datepicker1" style="width: 75px;" value="<?php echo $this->_tpl_vars['start_date']; ?>
" />
            ~
            <input type='text' name='end_date' id="datepicker2" style="width: 75px;" value="<?php echo $this->_tpl_vars['end_date']; ?>
" />
            &nbsp;&nbsp;
            <b>服务器ID:</b>
            <input type='text' name='book_id' style='width:120px;' class = "tt"  value="<?php echo $this->_tpl_vars['book_id']; ?>
" />
            &nbsp;&nbsp;
            <b>书籍名:</b>
            <input type='text' name='book_name' style='width:120px;' class = "tt"  value="<?php echo $this->_tpl_vars['book_name']; ?>
" />
            &nbsp;&nbsp;
            <b>书籍后缀:</b>
            <input type='text' name='book_suffix' style='width:120px;' class = "tt"  value="<?php echo $this->_tpl_vars['book_suffix']; ?>
" />
            &nbsp;&nbsp;
            <input type="submit" value = "查询" class = "sub">
        </form>
    </div>
    <div class="comTable">
        <form action="" method="POST" id="form1" >
            <table class="tableSort" >
                <tr class="title">
                    <td ><input type="checkbox" name = "" value ="" rel = "parent">ID序号| BOOK_ID</td>
                    <td >书籍名|后缀</td>
                    <td >作者名</td>
                    <td title="whowant2@163.com@q8XX">请求发<a href="http://mail.163.com/" target="_blank">邮件</a>|读取附件地址 | 保存至本地</td>
                    <td >添加时间</td>
                    <td width="120"> 管理 </td>
                </tr>

                <?php if (! empty ( $this->_tpl_vars['list'] )): ?>
                <?php $_from = $this->_tpl_vars['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['v']):
?>
                <tr>
                    <td><input type = "checkbox" name = "ids[]" value="<?php echo $this->_tpl_vars['v']['id']; ?>
" rel ="child" /><?php echo $this->_tpl_vars['v']['id']; ?>
 | <?php echo $this->_tpl_vars['v']['book_id']; ?>
 </td>
                    <td> <?php echo $this->_tpl_vars['v']['book_name']; ?>
 | <?php echo $this->_tpl_vars['v']['book_suffix']; ?>
 </td>
                    <td> <?php echo $this->_tpl_vars['v']['book_author']; ?>
 </td>
                    <td><a class="ajax_send_url" atturl="" attbookid="<?php echo $this->_tpl_vars['v']['book_id']; ?>
" attid="<?php echo $this->_tpl_vars['v']['id']; ?>
" href="javascript:;"><?php if ($this->_tpl_vars['v']['caiji_is_call']): ?>重发(<?php echo $this->_tpl_vars['v']['caiji_is_call']; ?>
)<?php else: ?>请求发送<?php endif; ?></a>
                    =&gt;
                    <a class="ajax_read_email"  attbookid="<?php echo $this->_tpl_vars['v']['book_id']; ?>
" href="javascript:;"><?php if ($this->_tpl_vars['v']['caiji_read_email_url']): ?>已存在<?php else: ?>采集附件地址 <?php endif; ?></a>
                    =&gt;
                    
                        <?php if ($this->_tpl_vars['v']['caiij_ok']): ?>
                            <a href="<?php echo $this->_tpl_vars['v']['book_path']; ?>
" >本地打开</a> 
                        <?php else: ?>
                            <a class="ajax_down_url" attid="<?php echo $this->_tpl_vars['v']['id']; ?>
" href="javascript:;">采集到服务器</a>
                        <?php endif; ?>
                    </td>
                    <td> <?php echo $this->_tpl_vars['v']['add_date']; ?>
 </td>
                    <td> <a href="?ct=book&ac=edit&id=<?php echo $this->_tpl_vars['v']['id']; ?>
" class="edit">修改</a><a href="?ct=book&ac=del&id=<?php echo $this->_tpl_vars['v']['id']; ?>
" class="delete" onclick="return confirm('确定删除该用户?')">删除</a> </td>
                </tr>
                <?php endforeach; endif; unset($_from); ?>
                <?php endif; ?>
                <tr>
                    <td colspan="9" align="center" bgcolor="#FFFFFF"><?php echo $this->_tpl_vars['pages']; ?>
</td>
                </tr>

            </table>

        </form>
    </div>
</div>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "footer.tpl", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<script>
    $(function(){
        $(".ajax_send_url").click(function(){
            var book_id = $(this).attr('attbookid');
            var id = $(this).attr('attid');
            t = $(this);

            $.ajax({
                url: "/index.php?ct=book&ac=ajax_call_send",
                dataType: "json",
                data: {"book_id":book_id,"id":id},
                type: "post",
                success: function(data) {
                    if (data.errcode == 0) {

                        t.hide();
                        if(confirm(data.msg+'并刷新页面？')){
                            window.location.reload();
                        }

                    } else {
                        alert(data.msg);

                    }
                },
                error: function(xhr, type) {
                    alert("提交失败，请重新提交");
                }
            })
        });

        $(".ajax_read_email").click(function(){

            $.ajax({
                url: "/index.php?ct=book&ac=ajax_read_email",
                dataType: "json",
                data: {},
                type: "post",
                success: function(data) {
                    if (data.errcode == 0) {
                        if(confirm(data.msg+'并刷新页面？')){
                            window.location.reload();
                        }


                    } else {
                        alert(data.msg);

                    }
                },
                error: function(xhr, type) {
                    alert("提交失败，请重新提交");
                }
            })
        })
        $(".ajax_down_url").click(function(){
            var id = $(this).attr('attid');
            $.ajax({
                url: "/index.php?ct=book&ac=ajax_down_book",
                dataType: "json",
                data: {"id":id},
                type: "get",
                success: function(data) {
                    if (data.errcode == 0) {
                        if(confirm(data.msg+'并刷新页面？')){
                            window.location.reload();
                        }lert(data.msg);

                    } else {
                        alert(data.msg);

                    }
                },
                error: function(xhr, type) {
                    alert("提交失败，请重新提交");
                }
            })
        })


    })
</script>